<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class OAEmail extends Model
{
    protected $table = 'emails';
    public $timestamps = false;

    public static function getEmailList($uid)
    {
        return self::query()
            ->where('uid_to',$uid)
            ->groupBy('uid_from')
            ->orderBy('id','desc')
            ->select(['uid_from','uid_to','desc','state','pub_date'])
            ->get()
            ->toArray();
    }
}
